/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package basico; 

/**
 *
 * @author curso
 */
public class Calculadora {   
    String modelo;
    
    //constructor
    Calculadora(String modelo){
        this.modelo = modelo;
        System.out.println("Calculadora " + modelo + " encendida");
    }
    
    
    double sumar (double op1, double op2){
//        double res = op1 + op2;
//        return res;
        return op1 + op2;
    }
    
    double restar (double op1, double op2){
//        double res = op1 - op2;
//        return res;
        return op1 - op2;
    }
    
    double multiplicar (double op1, double op2){
//        double res = op1 * op2;
//        return res;
        return op1 * op2;
    }
    
    double dividir (double op1, double op2){
//        double res = op1 / op2;
//        return res;
        return op1 / op2;
    }
    
    double factorial(double factorial){
        double fact = 1;
        int i = 1;
        
        //if (factorial >= 0){
            
            if (factorial == 0){
                fact = 1;
            }
            else
                while( i >= factorial){
                    fact = fact * i;
                    i++;
                }
            
        return fact;
        //else{
          //  System.out.println("Error, número incorrecto");
        }
        
    
    public static void main(String[] args) {
        Calculadora c1 = new Calculadora("Casio 900");
        double suma = c1.sumar(32, 98);
        double suma2 = c1.sumar(suma, 5);
        System.out.println("Resultado: " + suma2);
        System.out.println(c1.factorial(1.0));
    }
}
